import axios from "./cofing";

//定义请求接口

//登入

export const loginApi = (username, password) =>
  axios.post("/api/users/login", {
    username,
    password,
  });

//获取验证码

export const getCaptchaApi = () => axios.get("/api/users/getCaptcha");

//校验验证码

export const verifyCaptchaApi = (captcha) =>
  axios.get("/api/users/verifyCaptcha", {
    params: {
      captcha,
    },
  });

//获取生成二维码url

export const getQrcodeUrlApi = () => axios.get("/api/users/getScancode");

//微信登入

export const wechatLoginApi = (wechatCode) =>
  axios.get("/api/users/wechatLogin", {
    params: {
      wechatCode,
    },
  });

//登入日志

export const getLoginLogApi = (page = 1, count = 10) =>
  axios.get("/api/getloginlog", {
    params: {
      page,
      count,
    },
  });

//获取权限菜单=>这个接口一定要用户登入之后才能获取

export const getMenuListApi = () => axios.get("/api/permission/getMenuList");

//期望课程数据

export const expectDataApi = () => axios.get("/data/expect.json");

//折线图数据

export const lineDataApi = () => axios.get("/data/rate.json");

//任务进度数据

export const taskDataApi = () => axios.get("/data/tarsk.json");

//获取学员列表
export const getStuListApi = (page = "", count = 5, classes = "") =>
  axios.get("api/students/getstulist", {
    params: {
      page,
      count,
      class: classes,
    },
  });

//增加学员列表

export const addStuApi = (stuInfo) =>
  axios.post("/api/students/addstu", stuInfo);

//编辑学员

export const editStuApi = (stuInfo) =>
  axios.post("/api/students/updatestu", stuInfo);

//删除学员信息

export const delStuApi = (sId) =>
  axios.get("/api/students/delstu", {
    params: {
      sId,
    },
  });

//获取班级列表
export const getClassesApi = () => axios.get("/api/students/getclasses");
